home *** CD-ROM | disk | FTP | other *** search
/ AppleScript - The Beta Release / AppleScript - The Beta Release.iso / Goodies / Scripting Additions Goodies / Show Variables OSAX Read Me < prev    next >
Text File  |  1992-11-23  |  3KB  |  39 lines

  1. The Show Variables OSAX displays values in a modal dialog and this give you a chance to take a closer look at the variables. Since AppleScript is a text scripting language and Quill is a text processing application, there is a tendency to think that AppleScript only teal with text and numeric data type. Actually AppleScript can deal with any other data types used in the Macintosh. That is why using the Display Dialog OSAX to show value of variables is not sufficient and we need another OSAX to do the job. This is a programmer’s tool rather than an end user tool. Data types are shown as four letter code rather than the AppleScript name. Object is shown as the object specifier record rather than chunk expression. This is a development version, so use with caution.
  2.  
  3. The syntax of the Show Variables command is
  4.  
  5. Show variables {name1,value1,name2,value2...}
  6.  
  7. For example if you have variables x, y and z and you want to look at them:
  8.  
  9. Show Variables {“x”,x,“y”,y,“z”,z}
  10.  
  11. If you just want to show a single variable, you may also say
  12.  
  13. Show Variables x
  14.  
  15. However, it may be ambiguous. If the value of x is {“Hi”, “there”}, the OSAX may think that “Hi” is the name of the variable and “there” is the value. So it may be a little bit safer to say
  16.  
  17. Show Variables {“X”,x}
  18.  
  19. A variable can be displayed in a number of ways. As a minimum you can do a hexdump of the value. You can do this by selecting the variable and hitting the hexdump button. 
  20.  
  21. If a ResEdit template exist for that data type, you can hit the template button to display the data according to the template. If a template does not exist, then the data will be hexdumped. A number of TMPL resources has been copied from ResEdit into the OSAX, you may add more of your own.
  22.  
  23. You can also look at the content of the variable. This can be done for the following cases
  24.  
  25. 1. The data type is TEXT.
  26. 2. The data type is PICT.
  27. 3. The data type is list.
  28. 4. The data type is reco.
  29. 5. The data type can be coerced to TEXT.
  30. 6. The data type can be coerced to PICT.
  31. 7. The data type can be coerced to reco.
  32.  
  33. If the data is a list or record, then a list of the items are displayed. You may select the items in the list or record to examine its content just like you can look at other variables.
  34.  
  35. If data can not be viewed by content, then template view and hexdump view will be attempted. Double click on a variable or item is the same as view by content.
  36.  
  37. For coercion, any coercion installed as coercion handler and built into the Apple Event Manager can be used. You may use OSAX coercion handlers. If you do not want to install them and yet use them from the Show Variable OSAX, you may change OSAX coercion handler resource type to type ‘PROC’ and put them inside the Show Variable OSAX file. As an example we have include two such coercion handler in the OSAX, one to coerce an alias to its full path name, the other to coerce an ICON to a PICT.
  38.  
  39.